import moment from 'moment'
import { getLabelByValue } from '@/utils/index'
import { recordStatusOptions, statusOptions, recordTypeOptions } from './attr'

// 送教任务管理 列表
export const sendColumns = [
  {
    title: '送教老师',
    dataIndex: 'teacherName',
    key: 'teacherName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '送教学生',
    dataIndex: 'studentName',
    key: 'studentName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '所在班级',
    dataIndex: 'class',
    key: 'class',
    width: 'auto',
    align: 'center',
    render: (val, row) => `${row.studentGrade}年级${row.studentClass}班`
  },
  {
    title: '所属学期',
    dataIndex: 'schoolTermName',
    key: 'schoolTermName',
    width: '200px',
    align: 'center'
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, statusOptions)
  },
  {
    title: '完成情况',
    dataIndex: 'totalNum',
    key: 'totalNum',
    width: 'auto',
    align: 'center',
    render: (val, row) => `${row.completedNum}/${val}`
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]

// 送教任务管理 详情
export const sendTaskDetailColumns = [
  {
    title: '送教任务id',
    dataIndex: 'id',
    key: 'id'
  },
  {
    title: '送教老师',
    dataIndex: 'teacherName',
    key: 'teacherName'
  },
  {
    title: '送教学生',
    dataIndex: 'studentName',
    key: 'studentName'
  },
  {
    title: '所在班级',
    dataIndex: 'studentClass',
    key: 'studentClass',
    render: (val, row) => `${row.studentGrade}年级${val}班`
  },
  {
    title: '所属学期',
    dataIndex: 'schoolTermName',
    key: 'schoolTermName'
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
    render: val => getLabelByValue(val, statusOptions)
  },
  {
    title: '完成情况',
    dataIndex: 'totalNum',
    key: 'totalNum',
    render: (val, row) => `${row.completedNum}/${val}`
  }
]

// 送教记录列表-详情中
export const sendRecordCol = [
  {
    title: '提报类型',
    dataIndex: 'type',
    key: 'type',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, recordTypeOptions)
  },
  {
    title: '提报时间',
    dataIndex: 'createdTime',
    key: 'createdTime',
    width: 'auto',
    align: 'center',
    render: val => moment(val).format('YYYY-MM-DD HH:mm:ss')
  },
  {
    title: '审核时间',
    dataIndex: 'approveTime',
    key: 'approveTime',
    width: 'auto',
    align: 'center',
    render: val => val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : ''
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, recordStatusOptions)
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]

// 送教记录管理 列表
export const sendRecordColumns = [
  {
    title: '送教老师',
    dataIndex: 'teacherName',
    key: 'teacherName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '送教学生',
    dataIndex: 'studentName',
    key: 'studentName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '所属学期',
    dataIndex: 'schoolTermName',
    key: 'schoolTermName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '提报时间',
    dataIndex: 'createdTime',
    key: 'createdTime',
    width: 'auto',
    align: 'center',
    render: val => moment(val).format('YYYY-MM-DD HH:mm:ss')
  },
  {
    title: '提报类型',
    dataIndex: 'type',
    key: 'type',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, recordTypeOptions)
  },
  {
    title: '审核状态',
    dataIndex: 'status',
    key: 'status',
    width: 'auto',
    align: 'center',
    render: val => getLabelByValue(val, recordStatusOptions)
  },
  {
    title: '操作',
    dataIndex: 'action',
    key: 'action',
    width: 'auto',
    align: 'center',
    isBtn: true
  }
]

// 送教统计报表
export const sendStaticColumns = [
  {
    title: '送教老师',
    dataIndex: 'teacherName',
    key: 'teacherName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '送教学生',
    dataIndex: 'studentName',
    key: 'studentName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '所属学期',
    dataIndex: 'schoolTermName',
    key: 'schoolTermName',
    width: 'auto',
    align: 'center'
  },
  {
    title: '送教教学计划',
    dataIndex: 'planScore',
    key: 'planScore',
    width: 'auto',
    align: 'center'
  },
  {
    title: `送教记录（4分/次）`,
    dataIndex: 'teachScore',
    key: 'teachScore',
    width: 150,
    align: 'center'
  },
  {
    title: `宣传美篇（1分/次）`,
    dataIndex: 'articleScore',
    key: 'articleScore',
    width: 150,
    align: 'center'
  },
  {
    title: '期末评价',
    dataIndex: 'assessScore',
    key: 'assessScore',
    width: 'auto',
    align: 'center'
  },
  {
    title: '送教总结',
    dataIndex: 'summaryScore',
    key: 'summaryScore',
    width: 'auto',
    align: 'center'
  },
  {
    title: '管理员评价',
    dataIndex: 'adminScore',
    key: 'adminScore',
    width: 'auto',
    align: 'center'
  },
  {
    title: '总计',
    dataIndex: 'totalScore',
    key: 'totalScore',
    width: 'auto',
    align: 'center'
  }
]
